import request from '@/utils/request'

// 创建工序节点物料
export function createProcessRouteProcessNodeMaterial(data) {
  return request({
    url: '/basic/process-route-node-material/create',
    method: 'post',
    data: data
  })
}

// 更新工序节点物料
export function updateProcessRouteProcessNodeMaterial(data) {
  return request({
    url: '/basic/process-route-node-material/update',
    method: 'put',
    data: data
  })
}

// 删除工序节点物料
export function deleteProcessRouteProcessNodeMaterial(id) {
  return request({
    url: '/basic/process-route-node-material/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除工序节点物料 */
export function deleteProcessRouteProcessNodeMaterialList(ids) {
  return request({
    url: `/basic/process-route-node-material/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得工序节点物料
export function getProcessRouteProcessNodeMaterial(id) {
  return request({
    url: '/basic/process-route-node-material/get?id=' + id,
    method: 'get'
  })
}

// 获得工序节点物料分页
export function getProcessRouteProcessNodeMaterialPage(params) {
  return request({
    url: '/basic/process-route-node-material/page',
    method: 'get',
    params
  })
}
// 导出工序节点物料 Excel
export function exportProcessRouteProcessNodeMaterialExcel(params) {
  return request({
    url: '/basic/process-route-node-material/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 根据工序节点ID获取工序节点物料
export function getMaterialAllByNodeId(params) {
  return request({
    url: '/basic/process-route-node-material/getMaterialAllByNodeId',
    method: 'get',
    params
  })
}

// 获得工序节点下的所有物料
export function getMaterialList(params) {
  return request({
    url: '/basic/process-route-node-material/get',
    method: 'get',
    params
  })
}
